UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gbAdP8i0A3savRFKiXTLzewosOPlnCqZEIe2OYWBhO4='
WHERE
key_id = '37f7720443e2fca6605400150f87ffeeb45c52509a8be44087eadccafd4fee12'
AND (
token = 'gbAdP8i0A3savRFKiXTLzewosOPlnCqZEIe2OYWBhO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)