UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OgvT9LVnFIUwnw06rCI77DQC3lM0tAlKvoAigDQLY7M='
WHERE
key_id = '5d85ecff6687d6568effe769d5e8f0312db9d977ba726d4d68ccaf8a0ff7355d'
AND (
token = 'OgvT9LVnFIUwnw06rCI77DQC3lM0tAlKvoAigDQLY7M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)