UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xWejjISQGPjTrDG6SPocXryVCc8NCu7Tv0arbk5/3fY='
WHERE
key_id = 'd8351d92e9940527e8bcd4346dc2623e73399f6a4faac277c55768158e5d60a1'
AND (
token = 'xWejjISQGPjTrDG6SPocXryVCc8NCu7Tv0arbk5/3fY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)