UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eJddcTr77doXq+G0MNcGusDjywqcmH39OR35amFxbXE='
WHERE
key_id = '1521a2837e03f143fb725a59857e44edaec4dc4cfe7331ca95e7902d9ca21c48'
AND (
token = 'eJddcTr77doXq+G0MNcGusDjywqcmH39OR35amFxbXE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)