UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0YzH9wA+92pnUsXYHou1LTTbyYxD+qumdrWWinRlwmc='
WHERE
key_id = 'fb016590059504bdf751dc7f7a1b297e290dda5c8b8e7b074b0e57c7e04b896a'
AND (
token = '0YzH9wA+92pnUsXYHou1LTTbyYxD+qumdrWWinRlwmc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)