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