UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y+RDNSuzmYtXEaYKVJjOxLN7YGEkNE6tH5mX3B0npkc='
WHERE
key_id = '31a32257ce8cf5746a2ac233e3ebd1401d425dfd4c10caf0bf94f3b39c520fed'
AND (
token = 'Y+RDNSuzmYtXEaYKVJjOxLN7YGEkNE6tH5mX3B0npkc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)