UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pKF9X3s1lWRkdr0QwiWlQL8/na3HGn3U/A7wPOEHqT4=' 
WHERE 
  key_id = '1f7bf015789d0bf525456019bc0501ca8b349f95309ae8e25318616794e6d83c' 
  AND (
    token = 'pKF9X3s1lWRkdr0QwiWlQL8/na3HGn3U/A7wPOEHqT4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027