UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r4OqYG0eIhdQM6I+/csNL4EaOB1PAKmg2EyRDG5ibUs='
WHERE
key_id = '66406f7053bb27cc3f855b27ab031dae102f33044c47cc840ed5cc86a0d34ab9'
AND (
token = 'r4OqYG0eIhdQM6I+/csNL4EaOB1PAKmg2EyRDG5ibUs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)