UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6mY1jVLYKGdTUqvnomUAsTIJeiFn0+dofbKq4wMOnoU='
WHERE
key_id = 'ea47ebc36c205d3bd262b1552e01ab047719c0dda4dbb433a067d2ef77a39502'
AND (
token = '6mY1jVLYKGdTUqvnomUAsTIJeiFn0+dofbKq4wMOnoU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)