UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g48LhubPH0mg0qQ362OOM1J574ya8MZeFLfXDau3HZ0=' 
WHERE 
  key_id = '9bc59617c8c8f18e707bc79a9d154047247796adaeb19a85c22276a8d1e7fe72' 
  AND (
    token = 'g48LhubPH0mg0qQ362OOM1J574ya8MZeFLfXDau3HZ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028