UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RFRqrjjjdlJ5jlZco5vtdUdZakD0UMpjbvb58wauf6g='
WHERE
key_id = '367bd05ea6386850c53ce0ffc0e9d97ee5633ba5a979e3b2d6d5809e11a87b37'
AND (
token = 'RFRqrjjjdlJ5jlZco5vtdUdZakD0UMpjbvb58wauf6g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)