UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pfivRVXXBE8J71+RZI2QLLSkC1HlLYyPOsleYHG4ACE='
WHERE
key_id = '06afe6663a5575833ca9815de30d52671c427a87543c001c1521096dcb03b9c7'
AND (
token = 'pfivRVXXBE8J71+RZI2QLLSkC1HlLYyPOsleYHG4ACE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)