UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qhB8HSLc3eU9D86slcQBU34Nwzum20lQ+Gb84Bn7v3s='
WHERE
key_id = 'a4271b702b8972b4c251dffba03a1caebd1efb10f13d0d4d0ef0fbf8bf5b0d68'
AND (
token = 'qhB8HSLc3eU9D86slcQBU34Nwzum20lQ+Gb84Bn7v3s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)