UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cFt4wwDuls0fkNhbLJjCKAtB+JvWJoQBW9j/vE745yc='
WHERE
key_id = '7202e58fd3086b83470394c24c02887f349da1f443f6bfb018406f43c81400ce'
AND (
token = 'cFt4wwDuls0fkNhbLJjCKAtB+JvWJoQBW9j/vE745yc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)