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