UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TJjMsvjPTV8k5b1XUDHDOLdri4PE5bzOKJ8Lw0q7nCM='
WHERE
key_id = '989bc843531517a1d00121d9bb1d0140b477f17fb24ce8c272219eee12a83cef'
AND (
token = 'TJjMsvjPTV8k5b1XUDHDOLdri4PE5bzOKJ8Lw0q7nCM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)