UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GLPYPH5WYsouZum+zqshdJDEEDbqBGuwzHyVRV3YT9w='
WHERE
key_id = 'f1dd81d55e4ddb60d65b87e660690809d37232904ea3ea9e0fbac5cb85c040fa'
AND (
token = 'GLPYPH5WYsouZum+zqshdJDEEDbqBGuwzHyVRV3YT9w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)