UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dpR9ZMWECpu3nrRPYPAtfS7t28C8TONiEYDdqtz+USg='
WHERE
key_id = 'a9ea7d2241a7fad12743624703bf8f31d18b2b1082d88e2dcb8e90d213f8c87a'
AND (
token = 'dpR9ZMWECpu3nrRPYPAtfS7t28C8TONiEYDdqtz+USg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)