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