UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y7hrarJKSAUaDT2474fY4ALtGnPZcypSzjYCfVCDWPs='
WHERE
key_id = 'af8a24be838857e76aa2aa2c07d7f9df6907571f1ea6692d6a4d9e54d12242c2'
AND (
token = 'Y7hrarJKSAUaDT2474fY4ALtGnPZcypSzjYCfVCDWPs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)