UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gKxYTI7aC7qAaFXjerzg+baxEUU9QbCLWw5SQAPIMck='
WHERE
key_id = 'fda3f1172c1f2742c515bddda900b99b48aafac32b4fd1bc2fddfa981656ef4a'
AND (
token = 'gKxYTI7aC7qAaFXjerzg+baxEUU9QbCLWw5SQAPIMck='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)