UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G7qNWgxMLPZW+RnRvLsAQVvXDAY3vNZ0QNwHAIXY0x4='
WHERE
key_id = '718d604d061ca0da148cf17b729d87f8bc5a8c7665d7e6d5615d3496d8d0a45d'
AND (
token = 'G7qNWgxMLPZW+RnRvLsAQVvXDAY3vNZ0QNwHAIXY0x4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)