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