UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NhHP6MSkmOgOT3PviDh+VSRHkoW2doeezC1U0pBn4Y8='
WHERE
key_id = 'a953084e30748cb03d9ce8b4af4c29a4f8ca55ad9389d668b1de5d6d62034a22'
AND (
token = 'NhHP6MSkmOgOT3PviDh+VSRHkoW2doeezC1U0pBn4Y8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)