UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p8D+FO7PZ9FciYfjOz3zl7I/RoofcX2TZzryaExP/SM=' 
WHERE 
  key_id = '65a3df94bfb42d404df8954079c43f1e593919bc40b1cdbb4cb52992b869284f' 
  AND (
    token = 'p8D+FO7PZ9FciYfjOz3zl7I/RoofcX2TZzryaExP/SM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033