UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3fbABdzQvPIzVNME4YZGyHy418hwLvtsuPl4L3GDYx4=' 
WHERE 
  key_id = '871ae7b7c821402492d18760c28d38518f466115245f4d0a94372589b066b982' 
  AND (
    token = '3fbABdzQvPIzVNME4YZGyHy418hwLvtsuPl4L3GDYx4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037