UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ahEQed3TpcZ25Rq3y4eFlCMUdvtEONjDyaT1qNb/V6A='
WHERE
key_id = 'a931a4e104ea591e5e08b2c1eee1e4c8fbac41e7d900df31fdccc1a657d49939'
AND (
token = 'ahEQed3TpcZ25Rq3y4eFlCMUdvtEONjDyaT1qNb/V6A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)