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