UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pte65rYlZwd/9Vx8eAt8MnoWpnpgLkG9dc/GzG7EqKE='
WHERE
key_id = 'd1572167a7a22eb63dbac62acdbe14a8583c005c8857149ca923ae4751686eb2'
AND (
token = 'pte65rYlZwd/9Vx8eAt8MnoWpnpgLkG9dc/GzG7EqKE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)