UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cNMWQyb+LG7hNmAIF2ebc41htAtmRx7utxgaW9As3Mg=' 
WHERE 
  key_id = '97dd401ce6020407e95b9e6957792de6022cb9a4467a439cd7190dc7c253c212' 
  AND (
    token = 'cNMWQyb+LG7hNmAIF2ebc41htAtmRx7utxgaW9As3Mg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022