UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mzobyWyPhg8aATFbSwhLrx44cmR2PHY+4YY1SEnPlqY=' 
WHERE 
  key_id = 'b8f2191995adbd06878cdec675997b421d24ecfc8e8f7d65d8bc6a79173a26d6' 
  AND (
    token = 'mzobyWyPhg8aATFbSwhLrx44cmR2PHY+4YY1SEnPlqY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034