UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sRVutimM1wkzYHrhIy5KghPx8fx0sOw0NYkXDkLHj3k=' 
WHERE 
  key_id = '2e0435a1971278e4221a1c8f51ca03b9504d1f03789034fbfc71b51063f5533b' 
  AND (
    token = 'sRVutimM1wkzYHrhIy5KghPx8fx0sOw0NYkXDkLHj3k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036