UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dKUpKz9iPGIXAsR48vZp8vCVozpBYvZM6lqc+ZFFI9A='
WHERE
key_id = '813e4a787dcffb5519706ccf96cf7ed5039cd147c0d38b5c665896a0561b172e'
AND (
token = 'dKUpKz9iPGIXAsR48vZp8vCVozpBYvZM6lqc+ZFFI9A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)